package com.zuozuo.reflection;

public class demo1 {
    public static void main(String[] args) throws ClassNotFoundException {
        Class<Person> c1 = Person.class;
        Class<? extends Person> c2 = new Person().getClass();
        Class<?> c3 = Class.forName("com.zuozuo.reflection.Person");
        System.out.println(c1.hashCode());
        System.out.println(c2.hashCode());
        System.out.println(c3.hashCode());
        System.out.println(c1.getSuperclass());


    }


}

class Person{
    String name;

    public Person() {
    }

    public Person(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

class Student extends  Person{
    public Student(){
        this.name = "学生";
    }
}
class Teacher extends  Person{
    public Teacher(){
        this.name = "老师";
    }
}